package py.com.fms.utilities;

import java.math.BigDecimal;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.faces.FacesMessages;


@Name("nullAssist")
@Scope(ScopeType.SESSION)
public class NullAssistant<T> {
	
	private T objeto;
	
	public NullAssistant(T objeto) {  
		 this.setObjeto(objeto);  
	}
	
	
	public static String checkNullString(String param){
		if(param == null){
			String object = new String("");
			System.out.println("** En checkNullString: String= ".concat(object.toString()));
			return object; 
		}else{
			System.out.println("PARAM IS NOT NULL: ".concat(param.toString()));
			return param;

		}
	}
	
	public static Long checkNullLong(Long param){
		if(param == null){
			Long object = new Long(0);
			System.out.println("** En checkNullLong: Long= ".concat(object.toString()));
			return object; 
		}else{
			System.out.println("PARAM IS NOT NULL: ".concat(param.toString()));
			return param;

		}
	}
	
	public static Double checkNullDouble(Double param){
		if(param == null){
			Double object = new Double(0);
			System.out.println("** En checkNullDouble: Double= ".concat(object.toString()));
			return object; 
		}else{
			System.out.println("PARAM IS NOT NULL: ".concat(param.toString()));
			return param;

		}
	}
	public static BigDecimal checkNullBigDecimal(BigDecimal param){
		if(param == null){
			BigDecimal object = new BigDecimal(0);
			System.out.println("BigDecimal: ".concat(object.toString()));
			return object; 
		}else{
			System.out.println("PARAM IS NOT NULL: ".concat(param.toString()));
			return param;

		}
	}

	public void setObjeto(T objeto) {
		this.objeto = objeto;
	}

	public T getObjeto() {
		return objeto;
	}

}
